﻿using System.Collections.Generic;

namespace MatrixEditor
{
	internal class Global
	{
		private static readonly int __DEFAULT_PERIOD = 100; // ms
		private static readonly int __period = __DEFAULT_PERIOD;

		private static readonly int[,] __DEFAULT_COLORS = {
			{ 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00 }, { 0x7f, 0x7f, 0x7f }, { 0xc3, 0xc3, 0xc3 },
			{ 0x88, 0x00, 0x15 }, { 0xb9, 0x7a, 0x57 }, { 0xed, 0x1c, 0x24 }, { 0xff, 0xae, 0xc9 },
			{ 0xff, 0x7f, 0x27 }, { 0xff, 0xc9, 0x0e }, { 0xff, 0xf2, 0x00 }, { 0xef, 0xe4, 0xb0 },
			{ 0x22, 0xb1, 0x4c }, { 0xb5, 0xe6, 0x1d }, { 0x00, 0xa2, 0xe8 }, { 0x99, 0xd9, 0xea },
			{ 0x3f, 0x48, 0xcc }, { 0x70, 0x92, 0xbe }, { 0xa3, 0x49, 0xa4 }, { 0xc8, 0xbf, 0xe7 },
		};
		private static int[,] __colors = {};

		public static List<int[]> Frames { get; set; } = new List<int[]>(20);

		public static int[,] Colors
		{
			get
			{
				if (__colors.Length == 0) { ResetColors(); }

				return __colors;
			}
		}

		public static int DefaultPeriod { get; } = __DEFAULT_PERIOD;

		/// <summary>
		/// 动画播放延时间隔时间（毫秒）
		/// </summary>
		public static int Period { get; set; } = __period;

		public static bool SingleColor { get; set; } = false;

		public static bool FileChanged { get; set; } = false;

		public static void ResetColors()
		{
			__colors = (int[,])__DEFAULT_COLORS.Clone();
		}
	}
}
